home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-17 | 3.9 KB | 115 lines | [ttro/ttxt] |
-
- ____________________________________________________
-
- Offset In List ver. 1.0
-
- Copyright (C) 1994 Wayne Walrath
-
- ____________________________________________________
-
- This software is free for personal use. To obtain a cheap and simple
- license for corporate, commercial or institutional use, contact the
- author at one of the addresses listed at the end of this document.
- THIS SOFTWARE IS PROVIDED AS IS WITHOUT WARRANTIES. USE AT YOUR OWN
- RISK! You are encouraged to share this software with other people and
- to upload it to online services, but you may not charge money for it
- and you should only transfer the complete package. Contact me if you
- doubt whether you have a complete package. Inclusion on CD-ROMs
- requires explicit permission from me (the author).
-
-
- Offset In List is an AppleScript Scripting Addition (OSAX) which
- searches for an argument among the items of a list, returning either
- the item number where the target was found, or optionally, the next
- item in the list. Optional parameters allow you to specify case
- sensitivity and whether to allow partial matches.
-
-
- I'd like to thank David Jokinen of Ground Zero Software for generously creating
- an interesting sample script (Query) to show off the abilities of Offset In
- List, for coming up with the terminology "Offset In List" which is a lot nicer
- than what I was contemplating, ;-) and finally for all the excellent beta
- testing. Additionally, I want to thank Dennis Whiteman for being an all-around
- great beta tester. Quite a few other people have helped me test the ACME Script
- Widgets and I appreciate it. You know who you are.
-
-
- INSTALLATION:
- ______________________
- To install: Drag Offset In List to the Scripting Additions folder
- inside the Extensions folder.
-
-
-
- USAGE:
- _______________
-
- offset in list <list> of <string>
- [ returning next item <bool> ]
- [ searching <even items/odd items/every item> ]
- [ case <sensitive/insensitive> ]
- [ exact match <boolean> ]
-
-
- Considering the parameters in order, here's what they are for:
-
- The direct parameter <list> is the list of items to search through.
-
- <string> is the target to search for.
-
- Returning... determines whether you want the item number where the
- target is found to be returned, or instead the next item after the
- item where target is found. Returning the offset is the default. The
- intended use for this option is in working with association lists
- (poor-man's records), where you have <key, value> pairs in a list.
-
- Searching ... determines whether every item is searched or only even or
- odd items. If you are working with <key, value> pairs, you would only
- want to search odd items to avoid finding find the target in a value
- item instead of in a key item. Default is to search every item.
-
- Case ... determines whether case is considered in the search. Sensitive is
- default.
-
- Exact match... if this is set to true (default) the match must be exact
- (however, using the _case_ option modifies this behavior), if set to
- false, it will look for substring matches.
-
-
-
-
- EXAMPLES:
- _______________
-
- offset in list {"Apple", "Script"} of "apple"
- => 0 -- not found because case sensitive search performed by default
-
- offset in list {"Apple", "Script"} of "apple" case insensitive
- => 1 -- found in first element of list
-
- offset in list {"Apple", "Script"} of "Scr" exact match false
- => 2 -- matched first three letters of second item
-
- offset in list {"Apple", "Script"} of "App" exact match false¬
- returning next item true
- => "Script" -- matched first item and returned next item
-
- offset in list {"Apple", "Script"} of "App" exact match false¬
- returning next item true searching even items
- => "" -- didn't match the first item because only even items searched
-
-
- ______________________
- Comments, bug reports and suggestions are welcomed.
-
-
- ___________________________
- Wayne Walrath
- 2010 Ravenswood Dr.
- Evansville, IN 47714
- (812) 476-8610
- walrath@cs.indiana.edu
- CIS: 70233,3151
- ___________________________
-
-